@echo off

setlocal

set version=Debug
set objname=ISort
set target="%~dp0%version%\%objname%.dll"

if not exist %target% (
  echo %target% is not generated!
  goto end
)

set clsid={7E16D339-03C7-40a9-9A8A-23B4A970823D}
set regbase=HKLM\Software\Classes\CLSID\%clsid%

set desc="%objname% COM component"

reg add %regbase% /f /ve /t REG_SZ /d %desc% > nul 2>&1
if %errorlevel% neq 0 (
  echo Run this batch file as administrator!
  goto end
)
reg add %regbase%\InprocServer32 /f /ve /t REG_SZ /d %target% > nul 2>&1
reg add %regbase%\InprocServer32 /f /v ThreadingModel /t REG_SZ /d both > nul 2>&1

echo DONE!

:end
endlocal
pause